fix(docs): prevent scroll-to-top on restart/fast buttons in termynal.js#1889
Closed
cesar32az wants to merge 1 commit into
Closed
fix(docs): prevent scroll-to-top on restart/fast buttons in termynal.js#1889cesar32az wants to merge 1 commit into
cesar32az wants to merge 1 commit into
Conversation
The "restart" and "fast" controls in the animated terminal blocks are anchors with href='#', so clicking them can navigate to '#' and jump the page to the top. Use javascript:void(0) instead, matching the fix already merged in fastapi/fastapi#13714 for the same vendored file.
Contributor
📝 Docs previewLast commit 9d784a9 at: https://8bfd03ab.typertiangolo.pages.dev Modified Pages |
svlandeg
reviewed
Jul 7, 2026
svlandeg
left a comment
Member
There was a problem hiding this comment.
Please follow the contribution guidelines. A discussion was posted and is awaiting maintainer's decision. Do not open PRs without a maintainer's approval, as this creates too heavy a maintenance burden. Thanks 🙏
Contributor
|
Thank you @svlandeg, as this was my discussion. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the intermittent scroll-to-top when clicking the "restart" / "fast" controls on the animated terminal blocks in the docs, reported in discussion #1887 (credit to the reporter for the find and the FastAPI-vs-Typer comparison).
Root cause: both controls are anchors with
href='#'. Although the click handlers calle.preventDefault(), navigation to#can still slip through (e.g. when restart wipescontainer.innerHTMLmid-event), jumping the page to the top, which matches the "sometimes happens, sometimes doesn't" behavior described in the report.This is a 1:1 port of the fix already merged and live on the FastAPI docs: fastapi/fastapi#13714, the same two lines in the same vendored
termynal.js, usingjavascript:void(0)so the anchor never navigates.Verification
docs/js/termynal.jswas otherwise already in sync with FastAPI's copy except for these two lines.Related discussion: #1887
Supersedes #1888 (closed to resubmit with a cleaner commit).